import axios from "axios";

const API_URL = "http://localhost:8080/app/company"

export const getAllCompany=(pageNumber)=>{
    console.log("pageNum = " + pageNumber)
    if(pageNumber){
        return axios.get(`${API_URL}/page/${pageNumber}`)
    }
    return axios.get(API_URL)
}

export const getCompanyById=(id)=>{
    return axios.get(`${API_URL}/${id}`)
}

export const saveCompany=(company)=>{
    return axios.post(`${API_URL}`,company)
}

export const updateCompany=(company)=>{
    return axios.put(`${API_URL}`,company)
}

export const deleteCompany=(id)=>{
    return axios.delete(`${API_URL}/${id}`)
}